/*
    Copyright 2010 Northbranchlogic, Inc.

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
 */
package com.norbl.runjrun;

/**
 *
 * @author Barnet Wagman
 */
public class Constants {

        // SDB table constants
    public static String NODE_TABLE_NAME = "RJR_Nodes";
    public static String TASK_TABLE_NAME = "RJR_Tasks";

        // Node constants
    public static final String JAR_S3_KEY_PREFIX_DEFAULT = "runjrun-jars";
    public static final String APP_DIR_PATH_DEFAULT = "/home/runjrun";
    public static final String JAR_DIR_PATH_DEFAULT =
                            APP_DIR_PATH_DEFAULT + "/jars";
    public static final String TASKQUEUE_NAME_DEFAULT = "RunJRunTaskQueue";   
    public static final Long EMPTY_QUEUE_NAP_MILLIS_DEFAULT =
                                        new Long(1000L * 15L);

        /** Max time a task object listed in a task message can be
         *  missing from S3 before the task is removed from the queue.
         *  The default is now 24 hours in millis.  The missing duration
         *  is measured from the time a {@link RunnerNode} was launcehd,
         *  so this value is virtually infinite.  I.e. we normally don't
         *  want to delete a task that is missing it's object.
         */
    public static final long MAX_MISSING_TASK_MILLIS_DEFAULT =
                    new Long(1000L * 60L * 60L * 24L);
                                        // new Long(1000L * 60L * 5L);
    public static final long CLEAN_INTERVAL_MILLIS_DEFAULT =
                                new Long(1000L * 60L * 15L);
    public static final long PULSE_INTER_MILLIS_DEFAULT =
                                new Long(1000L * 60L * 5L);

    public static final String NODE_JVM_PARAMS_DEFAULT =
                                    " -server -XX:+UseSerialGC ";

    public static final int NODE_MAX_HEAP_GB_DEFAULT = 7;

        // S3 constants
    public static final Long S3_RETRY_INTERVAL_MILLIS_DEFAULT = new Long(1000L);
    public static final Long S3_MAX_WAIT_MILLIS_DEFAULT =
                                    new Long(1000L * 60L);
    public static long MAX_S3_PUT_WAIT_MILLIS_DEFAULT = 1000L * 60L * 5L;

        // S3 path constants
    public static String INPUT_S3KEY_PREFIX_DEFAULT = "RunJRun-input";
    public static String OUTPUT_S3KEY_PREFIX_DEFAULT = "RunJRun-output";
    public static final String EXCEPTION_S3_KEY_PREFIX_DEFAULT = "RunJRun-exceptions";

       // SDB constants
    public static final Long SDB_RETRY_INTERVL_MILLIS_DEFAULT = new Long(1000L);
    public static final Long SDB_MAX_WAIT_MILLIS_DEFAULT =
                                                new Long(1000L * 60L);

       // Monitor constants.
    public static final long MONITOR_DAQU_INTERVAL_MILLIS = 1000L;
    public static final long MONITOR_UPDATE_INTERVAL_MILLIS_DEFAULT =
                                    1000L * 3L;

       // Ec2 constants
       /** The default is aki-9800e5f1.  This is the 64-bit xen 2.6.18
        *  kernel that AWS strongly recommends for use with large cpu and
        *  large memory instances.
        *
        */
//    public static String KERNEL_ID_DEFAULT = "aki-9800e5f1";

       // Standard property names
    public static enum PN {
        awsAccessID, awsSecretKey, bucketName
    }

    public static String NIL = "nil";
    public static long GET_COOKED_TASK_NAP_MILLIS = 1000L * 30L;
    public static String NOT_EC2 = "not-ec2";

        // ---------- Instance constants ---------------------------

    public static long INSTANCE_MONITOR_INTERVAL_MILLIS = 1000L * 10L;
}
